package com.liuyucheng.idea_springboot.util;

import com.github.pagehelper.PageInfo;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;

public class PageQuery<T> {
    @Valid
    @NotNull(
            message = "查询对象不能为空!"
    )
    private T data;
    @NotNull(
            message = "分页对象不能为空!"
    )
    private PageInfo pageInfo;

    public PageQuery() {
    }

    public T getData() {
        return this.data;
    }

    public PageInfo getPageInfo() {
        return this.pageInfo;
    }

    public void setData(final T data) {
        this.data = data;
    }

    public void setPageInfo(final PageInfo pageInfo) {
        this.pageInfo = pageInfo;
    }

    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof PageQuery)) {
            return false;
        } else {
            PageQuery<?> other = (PageQuery)o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                Object this$data = this.getData();
                Object other$data = other.getData();
                if (this$data == null) {
                    if (other$data != null) {
                        return false;
                    }
                } else if (!this$data.equals(other$data)) {
                    return false;
                }

                Object this$pageInfo = this.getPageInfo();
                Object other$pageInfo = other.getPageInfo();
                if (this$pageInfo == null) {
                    if (other$pageInfo != null) {
                        return false;
                    }
                } else if (!this$pageInfo.equals(other$pageInfo)) {
                    return false;
                }

                return true;
            }
        }
    }

    protected boolean canEqual(final Object other) {
        return other instanceof PageQuery;
    }

    public int hashCode() {
        int PRIME = 1;
        int result = 1;
        Object $data = this.getData();
        result = result * 59 + ($data == null ? 43 : $data.hashCode());
        Object $pageInfo = this.getPageInfo();
        result = result * 59 + ($pageInfo == null ? 43 : $pageInfo.hashCode());
        return result;
    }

    public String toString() {
        return "PageQuery(data=" + this.getData() + ", pageInfo=" + this.getPageInfo() + ")";
    }
}
